home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-28 | 3.5 KB | 140 lines | [TEXT/MPS ] |
- /*
- Dot2Dot Project Data
- Copyright: © Apple Computer, Inc. 1993-1994. All Rights Reserved.
- */
-
-
- refNum := OpenResFileX("Dot2Dot.rsrc");
- DefConst('kMrT,GetPICTAsBits("MrT",true));
- CloseResFileX(refNum);
-
- 42;
-
- // ---- End Project Data ----
-
-
- // ---- File Dot2Dot.t ----
- baseView :=
- {title: "Dot2Dot",
- viewBounds: {top: 0, left: 0, right: 240, bottom: 336},
- viewEffect: 67083429
- ,
- viewSetupFormScript:
- func()
- begin
- // resize to fit on all "small" newtons.
- local b := GetAppParams();
- constant kMaxWidth := 240;
- constant kMaxHeight := 336;
- self.viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
- MIN(b.appAreaWidth, kMaxWidth),
- MIN(b.appAreaHeight, kMaxHeight));
- end,
- _proto: protoApp,
- debug: "baseView"
- };
-
- drawingArea := /* child of baseView */
- {viewFlags: 529,
- viewFormat: 336,
- viewBounds: {left: 0, top: 40, right: 230, bottom: 270},
- viewDrawScript:
- func() // draw points based on polygon information
- begin
-
- // then draw points based on the polygon (pensize 2)
- :DrawShape(thePolygon, {penSize: 2});
- end,
- thePolygon: nil,
- viewClickScript:
- func(unit) // detect clicks and create a polygon based on the clicking
- begin
-
- // get global coordinates
- local temp := :GlobalBox();
-
- // get pen down locations
- newX := GetPoint(unitFirstX, unit);
- newY := GetPoint(unitFirstY, unit);
-
- // calculate the real values (local coordinates)
- newX := newX - temp.left;
- newY := newY - temp.top;
-
- // store these points into the pointArray
- pointArray := SetAdd(pointArray, newX, nil);
- pointArray := SetAdd(pointArray, newY, nil);
-
- // build a new polygon shape
- thePolygon := nil;
- thePolygon := MakePolygon(pointArray);
-
- If length(pointArray) = 2*14 then
- SetValue(self,'icon,kMrT);
-
- // then force redraw
- :Dirty();
- end,
- newX: nil,
- newY: nil,
- pointArray: nil,
- viewSetupFormScript:
- func()
- begin
- pointArray := [];
- thePolygon := MakePolygon(pointArray);
- end,
- eraseArea:
- func() // erase the contents of the viewbounds rect
- begin
- :DrawShape(MakeRect(viewbounds.top, viewBounds.left, viewBounds.bottom, viewBounds.right),
- {fillPattern: 1});
- end,
- ZapArray:
- func() // zap array to zero, and force a redraw (in other words erase!)
- begin
- SetLength(pointArray, 0);
- thePolygon := MakePolygon(pointArray);
- :Dirty();
- end,
- viewJustify: 16,
- icon: GetPictAsBits("Dots", 1),
- viewclass: 76,
- debug: "drawingArea"
- };
- // View drawingArea is declared to baseView
-
-
-
- theInfo := /* child of baseView */
- {text: "I pity the fool who connects the dots",
- viewBounds: {left: 18, top: 18, right: 218, bottom: 34},
- _proto: protoStaticText,
- debug: "theInfo"
- };
-
-
-
- wipeOut := /* child of baseView */
- {text: "Erase Poly",
- viewBounds: {left: 0, top: 276, right: 100, bottom: 296},
- buttonClickScript:
- func() // call Erase function inside DrawingArea
- begin
- drawingArea:ZapArray();
- SetValue(drawingArea,'icon,nil);
- end,
- viewJustify: 8388630,
- _proto: protoTextButton,
- debug: "wipeOut"
- };
-
-
-
-
-
-
-
- // ---- Beginning of section for non used Layout files ----
-
- // End of output